package com.bw.zyk.zhanggm.product.controller;

import com.bw.springboot.starter.upload.service.FileService;
import com.bw.springboot.starter.upload.util.FileResult;
import com.ruoyi.common.core.utils.file.FileUtils;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("file")
public class FileController {

    @Autowired
    FileService fileService;

    @PostMapping("upload")
    public AjaxResult upload(MultipartFile file) throws IOException {
        FileResult fileResult = fileService.upload(file);
//        FileUtils.writeBytes();
        return AjaxResult.success(fileResult);
    }

    public void test() {
//        ExcelUtil.
    }
}




